import request from '../../utils/request';
import requestUpload from '../../utils/requestUpload';
import store from '../../store/index';

// 获取活动信息
export function getLiveInfo() {
  return request.post('wxScan/chaoJiSaiYaRen', {
    splid: store.state.live.liveId,
  });
}

// 获取礼物列表
export function getGiftList() {
  return request.post('hmGiftController/listGift6', {
    splid: store.state.live.liveId,
  });
}

// hd2.0获取礼物列表
export function getGiftList2() {
  return request.post('hmGiftController/listGift7', {
    splid: store.state.live.liveId,
  });
}
// 获取红包口袋信息
export function getHBKDInfo() {
  return request.post('hbkd/shenLuoTianZheng6', {
    splid: store.state.live.liveId,
  });
}

// 加入游戏
export function attendGame() {
  return request.get(`sendMsgController/renGo6?splid=${store.state.live.liveId}&userId=${store.state.user.userId}`);
}

// 获取游戏状态
export function getGameStatus() {
  return request.get(`play/baiyan6?splid=${store.state.live.liveId}&userId=${store.state.user.userId}`);
}

// 上传照片
export function uploadPhoto(formData) {
  console.log(formData.get('prefix'), formData.get('file'));
  return requestUpload.post('beiJing/shangchuanTomcat', formData);
}
// 发送礼物
export function sendGift() {
  return request.post('hmGiftController/sendGift6', {
    splid: store.state.live.liveId,
    giftconst: store.state.app.currentGiftType,
  });
}

// 发送照片礼物
export function sendPhotoGift(content, imgUrl) {
  return request.post('hmGiftController/sendGift6', {
    splid: store.state.live.liveId,
    giftconst: store.state.app.currentPhotoType,
    content,
    tpUrl: imgUrl,
  });
}

// 发送霸气弹幕礼物
export function sendDanmuGift(content, giftSource) {
  return request.post('hmGiftController/sendGift6', {
    splid: store.state.live.liveId,
    giftconst: store.state.app.currentDanmuType,
    content,
    gift_source: giftSource,
  });
}

// 发送超级弹幕礼物
export function sendSuperDanmuGift(content, giftId) {
  return request.post('hmGiftController/buySuperBp', {
    splid: store.state.live.liveId,
    giftconst: giftId || store.state.app.currentSuperDanmuType,
    title: content,
  });
}

// 发送霸屏礼物
export function sendBapinGift(content) {
  return request.post('hmGiftController/sendGift6', {
    splid: store.state.live.liveId,
    giftconst: store.state.app.currentBapinType,
    content,
  });
}

// 发送手写签到文字
export function sendBubbleSignText(text) {
  return request.post('hmGiftController/sendHandSign', {
    splid: store.state.live.liveId,
    title: text,
    type: 'hand',
  });
}

// 获取发送礼物排行榜
export function getGiftRankList() {
  return request.post('hmGiftController/findGiftRankList6', {
    splid: store.state.live.liveId,
  });
}

// 购买进场特效
export function buyVipEnterEffect(giftId) {
  return request.post('hmGiftController/buyVipJc', {
    splid: store.state.live.liveId,
    giftconst: giftId,
  });
}

// 修改个人信息
export function editUserInfo(paramObj) {
  return request.post('hmGiftController/editUserInfo', {
    wx_name: paramObj.wx_name,
    avator: paramObj.avator,
    table_number: paramObj.table_number,
    position: paramObj.position,
    type: paramObj.type,
    splid: store.state.live.liveId,
  });
}
